home *** CD-ROM | disk | FTP | other *** search
- Developer docs:
-
-
- Patch.library provides a variety of types of patchcodes, depending
- on the need of an application.
-
-
-
-
- Different types of patchcodes:
-
- Type A:
- Your patchcode will be called as a subroutine BEFORE the original
- function.
-
- A type A patchcode is specified by passing a value greater than
- zero with PATT_Priroity during InstallPatchTags().
-
- Your patchcode will called with the same value as the original
- function would be called. Your patchcode must set up (or keep)
- the registers in a way that the original function can be called
- immediately after your function exits.
-
- Type A could be used for the following purposes:
- - counting the number of calls to a function
- - Send out a message, when a function is used (snoopdos)
- - ...
-
- Note: When programming in C have a look at PATT_UseXResult to
- keep (In C d0-d1/a0-a1 are scratch registers) or modify registers.
-
-
- Type B:
- Your patchcode will be called as a subroutine BEFORE the original
- function AND it is your task to call the original function.
-
- A type B patchcode is specified by passing a value greater than
- zero with PATT_Priroity AND PATT_Original during
- InstallPatchTags().
-
- Your patchcode will called with the same value as the original
- function would be called. Your patchcode must return the same
- result as the original function would have.
-
- You MUST ALWAYS call the original function (at the address
- provided by PATT_Original), even if skipping
- the original function seems to work.
- If you do not call the original function, patches with lower
- priority will not be executed.
-
- Type B could be used for the following purposes:
- - changing parameters for a function
- - ...
-
- Note:
- PATT_Original is new with V6 of patch.library.
- This type can be used much like SetFunction().
-
- Warning:
- Using PATT_Original right is tricky!
- Your patchcode must be ready to be called any time,
- even before InstallPatchTags() returns.
- This implies that the memory pointer passed
- with PATT_Original must be used within your
- patchcode to call the original function.
- To get around this problem, you may specify
- PATT_Disable, TRUE when installing your patchcode, which
- makes sure, that your patchcode will not be called
- until you call SetPatch( patch, PATT_Disable, FALSE, TAG_DONE);
-
-
- Type C:
- Your patchcode will be called as a subroutine INSTEAD of the
- original function.
-
- A type C patchcode is specified by passing zero with PATT_Priroity
- during InstallPatchTags().
-
- Your patchcode will called with the same value as the original
- function would be called. Your patchcode must return a result
- as the original function would have.
-
- You can call the original function by using the FALLBACK
- Assembler macro or by specifying Fallback with the PatchXResult
- system.
-
- Type C could be used for the following purposes:
- - Replacing certain OS-Functions by better ones
- (e.g.: CpuBlit, CpuClear, drivers for graphiccards,
- etc ...
- - ...
-
-
- Type D:
- Your patchcode will be called as a subroutine AFTER the
- original function.
-
- A type D patchcode is specified by passing a value less than zero
- with PATT_Priroity during InstallPatchTags().
-
- Your patchcode will called with the same returncode as the original
- function would have returned. Your patchcode must return a result
- as the original function would have.
-
- Type D could be used for the following purposes:
- - counting the number of calls to a function
- - Send out a message, when a function has failed
- - ...
-